package com.generic.interceptor;

import java.util.Map;

import com.generic.util.Constant;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;

public class Authorization implements Interceptor{

	private static final long serialVersionUID = -377585328406969728L;
	
	public String intercept(ActionInvocation invocation) throws Exception {

		Map<String,Object> session = invocation.getInvocationContext().getSession();
		if(session.get(Constant.SESSION_MEMBER) == null) {
			return Action.LOGIN;
		}

		return invocation.invoke();
	}

	public void destroy() {
	}
	
	public void init() {
	}
}